<script lang='ts' setup>
//@ts-nocheck
const tableData = ref([])
import { getExList } from '@/api/request.js'
const route=useRoute()
const cid=route.query.cid
const jwtToken = localStorage.getItem('jwtToken')
const result=ref([])

onMounted(async ()=>{
    let res=await getExList(jwtToken,cid)
    console.log(res);
    result.value = res.data.data
    result.value = result.value.map((item) => ({
			rid: item.id,
			eid: item.eid,
			sid: item.sid,
			cid: item.cid,
			name: item.name,
			ename:'',
			updateTime: item.createTime,
			state: item.state,
		}))
        result.value.forEach((element) => {
			// 把下面的if else 结构一直写到20
			if (element.eid === '1') {
				element.ename = '液体黏滞系数的测定'
			} else if (element.eid === '2') {
				element.ename = '液体表面张力系数的测定'
			} else if (element.eid === '3') {
				element.ename = '刚体转动惯量的测定'
			} else if (element.eid === '4') {
				element.eid = '振动法测材料的杨氏模量'
			} else if (element.eid === '5') {
				element.eid = '用稳态法测定不良导体的导热系数'
			} else if (element.eid === '6') {
				element.eid = 'AD590 集成电路温度传感器的特性研究及应用'
			} else if (element.eid === '7') {
				element.eid = '用板式电势差计测电源电动势'
			} else if (element.eid === '8') {
				element.eid = '电子示波器的使用'
			} else if (element.eid === '9') {
				element.eid = '电表改装与校准'
			} else if (element.eid === '10') {
				element.eid = '密立根油滴实验'
			} else if (element.eid === '11') {
				element.eid = '霍尔效应的测量和应用'
			} else if (element.eid === '12') {
				element.eid = '铁磁材料的磁滞回线和磁化曲线的测量'
			} else if (element.eid === '13') {
				element.eid = '磁阻效应及磁阻传感器特性的研究'
			} else if (element.eid === '14') {
				element.eid = '声速的测定'
			} else if (element.eid === '15') {
				element.eid = '单缝衍射光强分布的测量'
			} else if (element.eid === '16') {
				element.ename = '用牛顿环仪测量透镜的曲率半径'
			} else if (element.eid === '17') {
				element.ename = '迈克尔逊干涉仪的调节与使用'
			} else if (element.eid === '18') {
				element.eid = '用分光计测光波波长'
			} else if (element.eid === '19') {
				element.eid = '偏振光的研究'
			} else if (element.eid === '20') {
				element.eid = '压电陶瓷特性研究'
			}
		})
		tableData.value = result.value
		console.log("处理完的数据：",tableData.value);
})
</script>
<template>
<div>
    <el-table :data="tableData" style="width: 100%">
			<el-table-column prop="ename" width="300" label="实验"></el-table-column>
			<el-table-column prop="name" width="300" label="姓名"></el-table-column>
			<el-table-column prop="sid" label="学号" width="300"></el-table-column>
			<el-table-column prop="updateTime" label="提交时间"></el-table-column>
		</el-table>
</div>
</template>

<style scoped lang='scss'>

</style>